<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <h:head>
        <h:outputStylesheet library="css" name="reset.css"/>
        <h:outputStylesheet library="css" name="style(new).css"/>
        <h:outputStylesheet library="css" name="invalid.css"/>

        <h:outputScript library="js" name="simpla.jquery.configuration.js"/>
        <h:outputScript library="js" name="facebox.js"/>
        <h:outputScript library="js" name="jquery.wysiwyg.js"/>
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"  /> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>

        <ui:insert name="cabecalho"/>
    </h:head>

    <h:body>


        <div id="body-wrapper">
            <!-- Wrapper for the radial gradient background -->
            <div id="sidebar">
                <div id="sidebar-wrapper">
                    <!-- Sidebar with logo and menu -->
                    <h1 id="sidebar-title"><a href="#">PROIN</a></h1>
                    <!-- Logo (221px wide) -->
                    <a href="#">

                        <h:graphicImage id="logo" library="imagens" name="logo.png" alt="Simpla Admin logo"/>
                        <center style="font-weight: bolder;margin-top:-35px; margin-bottom: 25px ">Profissionais Integrados</center>
                    </a>

                    <!-- Sidebar Profile links -->
                    <div id="profile-links">
                        <h:form>
                            Bom dia, #{login.loginUsuario.fkTipoUsuario.designacao} <p:commandLink title="Troque a sua senha" value="#{login.nomeUtilizador}" onclick="diagAlterarSenha.show()"/>
                        </h:form>

                        <h:form>
                            <p:commandLink action="#{login.logout}" title="termine a sua sessão para o login" ajax="false" value="Terminar da Sessão"/>
                        </h:form>
                    </div>
                    <h:form>
                        <ul id="main-nav">
                            <!-- Accordion Menu -->
                            <li>
                                <p:commandLink value="Início" styleClass="nav-top-item no-submenu #{ param.inicio }" action="inicio" ajax="false"  >
                                    <f:param name="inicio" value="current"/>
                                </p:commandLink> <!-- Add the class "no-submenu" to menu items with no sub menu -->
                            </li>
                            <c:if test="#{login.temPermissao('gsto')}" >
                                <li>
                                    <a href="#" class="nav-top-item"> Gestão de Stock </a>
                                    <ul style="display: block;">
                                        <li>
                                            <a href="#">Contrução</a>
                                        </li>
                                    </ul>
                                </li>
                            </c:if>
                            <c:if test="#{login.temPermissao('gfin')}" >
                                <li>
                                    <a href="#" class="nav-top-item #{param.movimento}#{param.conta}#{param.moeda}#{param.tipoconta}"> Gestão Financeira </a>
                                    <ul style="display: none;">
                                        <li>
                                            <p:commandLink value="Lançamentos" styleClass="#{param.movimento}" action="listarMovimento" ajax="false">
                                                <f:param name="movimento" value="current"/>
                                            </p:commandLink> 
                                        </li>
                                        <li>
                                            <p:commandLink value="Tipo Contas" styleClass="#{param.tipoconta}" action="listarTipoConta" ajax="false">
                                                <f:param name="tipoconta" value="current"/>
                                            </p:commandLink>
                                        </li>
                                        <li>
                                            <p:commandLink value="Contas" styleClass="#{param.conta}" action="listarConta" ajax="false">
                                                <f:param name="conta" value="current"/>
                                            </p:commandLink>
                                        </li>
                                        <li>
                                            <p:commandLink value="Moedas" styleClass="#{param.moeda}" action="listarMoeda" ajax="false">
                                                <f:param name="moeda" value="current"/>
                                            </p:commandLink> 
                                        </li>
                                    </ul>
                                </li>
                            </c:if>
                            <c:if test="#{login.temPermissao('guti')}" >
                                <li>
                                    <a href="#" class="nav-top-item #{param.grupo}#{param.utilizador}#{param.permissoes}"> Gestão Utilizadores </a>
                                    <ul style="display: none;">
                                        <li>
                                            <p:commandLink value="Utilizadores" styleClass="#{param.utilizador}" action="listarUsuario" ajax="false">
                                                <f:param name="utilizador" value="current"/>
                                            </p:commandLink> <!-- Add the class "no-submenu" to menu items with no sub menu -->
                                        </li>
                                        <li>
                                            <p:commandLink value="Grupos" styleClass="#{param.grupo}" action="listarGrupo" ajax="false">
                                                <f:param name="grupo" value="current"/>
                                            </p:commandLink> <!-- Add the class "no-submenu" to menu items with no sub menu -->
                                        </li>
                                        <li>
                                            <p:commandLink value="Permissões" styleClass="#{param.permissoes}" action="listarPermissao" ajax="false">
                                                <f:param name="permissoes" value="current"/>
                                            </p:commandLink>
                                        </li>
                                    </ul>
                                </li>
                            </c:if>
                            <li>
                                <a href="#" class="nav-top-item">&nbsp;</a>   
                            </li>
                        </ul>
                    </h:form>
                    <!-- End #main-nav -->

                </div>
            </div>
            <!-- End #sidebar -->
            <div id="main-content">
                <!-- Main Content Section with everything -->
                <noscript>
                    <!-- Show a notification if the user has disabled javascript -->
                    <div class="notification error png_bg">
                        <div>
                            Javascript is disabled or is not supported by your browser. Please <a href="http://browsehappy.com/" title="Upgrade to a better browser">upgrade</a> your browser or <a href="http://www.google.com/support/bin/answer.py?answer=23852" title="Enable Javascript in your browser">enable</a> Javascript to navigate the interface properly.
                        </div>
                    </div>
                </noscript>
                <!-- Page Head -->
                <h2><ui:insert name="TituloModulo"/></h2>
                <p id="page-intro">
                    O que deseja fazer?
                </p>

                <p:ajaxStatus>
                    <f:facet name="start" >  
                        <h:graphicImage url="/resources/ajaxloading.gif" /> 
                    </f:facet>  

                    <f:facet name="default" >  
                        <h:outputText styleClass="ui-icon ui-icon-bullet" />
                    </f:facet>

                    <f:facet name="complete" >  
                        <h:outputText styleClass="ui-icon ui-icon-check" />
                    </f:facet>

                    <f:facet name="error">  
                        <h:outputText styleClass="ui-icon ui-icon-close" />
                    </f:facet>
                </p:ajaxStatus>

                <!-- End .shortcut-buttons-set -->
                <div class="clear"></div>

                <ui:insert name="menu"/>

                <div class="clear"></div>

                <!-- End .clear -->
                <div class="content-box">
                    <!-- Start Content Box -->
                    <div class="content-box-header">
                        <h3 style="cursor: s-resize;"><ui:insert name="TituloConteudoPrincipal"/></h3>

                        <div class="clear"></div>
                    </div>
                    <!-- End .content-box-header -->
                    <div class="content-box-content">

                        <ui:insert name="ConteudoPrincipal"/>

                    </div>
                    <!-- End .content-box-content -->
                </div>
                <!-- End .content-box -->
                <div class="clear"></div>
                <!-- Start Notifications -->
                <!-- End Notifications -->
                <div id="footer">
                    <center>
                        <small>
                            <!-- Remove this notice or replace it with whatever you want --> 
                            &copy; Copyright 2012 UCAN | Autorizado por <a href="#">PROIN Profissionais Integrados</a>
                        </small>
                    </center>
                </div><!-- End #footer -->
            </div>
            <!-- End #main-content -->
        </div>
        <div id="facebox" style="display:none;">
            <div class="popup">
                <table>
                    <tbody>
                        <tr>
                            <td class="tl"></td><td class="b"></td><td class="tr"></td>
                        </tr>
                        <tr>
                            <td class="b"></td><td class="body"><div class="content"></div>
                                <div class="footer">
                                    <a href="#" class="close"> <h:graphicImage library="imagens" name="closelabel.gif" title="close" styleClass="close_image"/> </a>
                                </div></td><td class="b"></td>
                        </tr>
                        <tr>
                            <td class="bl"></td><td class="b"></td><td class="br"></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <p:dialog visible="#{param.verificarsenha and login.senhaDefault()}"  widgetVar="diagAlterarSenha" resizable="false" draggable="false" closable="true" modal="true">
            <ui:include src="senha.xhtml"/>
        </p:dialog>
    </h:body>

</html>